<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03JS数据类型</title>
</head>
<body>
<script>
    //JS数据类型=原始类型 + 引用类型
    //原始类型:number string boolean null undefined
    var a = 1;
    var b = 6.6;
    console.log(a,typeof a);
    console.log(b,typeof b);
    var c = '你好';
    var d = "你们好";
    console.log(c,typeof c);
    console.log(d,typeof d);
    var e = true;
    var f = false;
    console.log(e,typeof e);
    console.log(f,typeof f);
    // 声明了变量,但未赋值,会得到undefined,未定义型
    var g;
    console.log(g,typeof g);//undefined 'undefined'

    //引用类型 Object Number String Boolean Array...
    //1)自定义JS对象
    let obj = {
        name:'张三',
        age:18,
        sex:'男'
    };
    console.log(obj,typeof obj);

    obj.age = 19;//age属性存在,则为修改属性的值
    console.log(obj.age);//19
    // 给对象动态新增一个like属性
    obj.like = '吃火锅';//like属性不存在,则为动态新增一个属性
    console.log(obj.like);
    console.log(obj)

    console.log(obj.play);//访问对象不存在的属性,会得到undefined

    //JS数组
    let arr = ['李逵','鲁班','后裔',1,6.6,false];
    console.log(arr,typeof arr);
    console.log(arr[0]);
    console.log(arr[5]);
    console.log(arr[99]);//访问数组不存在的下标,会得到undefined
</script>
</body>
</html>